package com.common.exception;

import com.common.result.Result;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author 路亚
 * @version 0.1
 * @className GlobalExceptionHandler
 * @description
 * @date 2024/12/11 14:49
 * @since jdk11
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler
    public Result exception(JavaSmException exception){
        Result result = new Result();
        result.setCode(exception.getCodeAndMsg().getCode());
        result.setMsg(exception.getCodeAndMsg().getMsg());
        return result;
    }
}
